package org.assocsp3.web;

import org.assocsp3.service.ActiviteService;
import org.slf4j.Logger;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.ModelMap;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/welcome")
public class WelcomeController {

	private Logger logger = org.slf4j.LoggerFactory.getLogger(WelcomeController.class);
	
	private ActiviteService activiteService;
	
	@Autowired
    public void setActiviteService(ActiviteService serv) {
        this.activiteService = serv;
    }
	
	@RequestMapping(method = RequestMethod.GET)
	public ModelMap welcome() {
		logger.info("Welcome!");
		return new ModelMap("activites", activiteService.findAll());
	}

}
